﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using MyPhotoIndex.Utilities;
using System.Drawing;
using System.Runtime.InteropServices;

namespace MyPhotoIndex.Controls.AutoCompleteToolstripTextBox
{
    class HelperForm : Form
    {
        private static Pen ms_borderPen;

        public HelperForm()
        {
            ms_borderPen = new Pen(Color.Black);
        }

        protected override void WndProc(ref Message m)
        {
            if (m.Msg == Win32Interop.WM_NCPAINT || m.Msg == 13)
            {
                IntPtr hDC = Win32Interop.GetWindowDC(m.HWnd);
                if (hDC != IntPtr.Zero)
                {
                    using (Graphics maing = Graphics.FromHdc(hDC))
                    {
                        Rectangle borderRect = new Rectangle(base.ClientRectangle.Location, base.ClientRectangle.Size);
                        //maing.FillRectangle(new SolidBrush(Color.White), borderRect);
                                borderRect.Inflate(new Size(-1, -1));
                        maing.DrawRectangle(ms_borderPen, borderRect);
                    }
                    Win32Interop.ReleaseDC(m.HWnd, hDC);
                }
                m.Result = IntPtr.Zero;
            }

            base.WndProc(ref m);
        }

        private void InitializeComponent()
        {
            this.SuspendLayout();
            // 
            // HelperForm
            // 
            this.ClientSize = new System.Drawing.Size(292, 273);
            this.Name = "HelperForm";
            this.ResumeLayout(false);

        }
    }
}
